!> author: 左志华
!> date: 2022-07-04
!>
!> 粒子域类型
module region_type_m

    use math_m, only: rp
    implicit none
    private

    public :: region_t

    !> 9 个粒子
    type region_t
        real(rp) :: loc(2, 9)   !! 位置
        real(rp) :: rho(9)      !! 密度
        real(rp) :: pressure(9) !! 压强
        real(rp) :: mass(9)     !! 质量
    contains
        procedure :: set_data
    end type region_t

contains

    !> 建立数据
    subroutine set_data(self)
        class(region_t), intent(out) :: self
        self%rho = 1000.0_rp
        self%pressure = 10.0_rp
        self%mass = 1000.0_rp

        self%loc(1, 1:5) = 0.0_rp
        self%loc(1, 6) = 1.0_rp
        self%loc(1, 7:9) = 2.0_rp

        self%loc(2, 1) = -1.0_rp
        self%loc(2, 2) = -0.5_rp
        self%loc(2, 3) = 0.0_rp     ! x     x
        self%loc(2, 4) = 0.5_rp     ! x
        self%loc(2, 5) = 1.0_rp     ! x  o  x
        self%loc(2, 6) = 0.0_rp     ! x
        self%loc(2, 7) = -1.0_rp    ! x     x
        self%loc(2, 8) = 0.0_rp
        self%loc(2, 9) = 1.0_rp

    end subroutine set_data

end module region_type_m
